<!-- TaskDetail.vue -->
<template>
  <div class="container">
    <h1>hhhh</h1>
    <nav-router></nav-router>
    <h2>{{ task.name }}</h2>
    <p>{{ task.description }}</p>
  </div>
</template>
  
  <script>
import NavRouter from "./NavRouter.vue";
export default {
  components: { NavRouter },
  name: "TaskDetail",
  data() {
    return {
      task: {},
    };
  },
  mounted() {
    // 获取路由params参数
    const taskId = this.$route.params.id;

    // 获取特定建议的详细信息
    this.task = this.tasks.find((task) => task.id === parseInt(taskId));
  },
  computed: {
    tasks() {
      return [
        {
          id: 1,
          name: "建议一",
          description:
            "旅游可以让人和家人、朋友、伴侣一起共度美好时光，增进彼此感情。",
        },
        {
          id: 2,
          name: "建议二",
          description:
            "旅游可以让人和家人、朋友、伴侣一起共度美好时光，增进彼此感情。",
        },
        {
          id: 3,
          name: "建议三",
          description:
            "旅游可以让人和家人、朋友、伴侣一起共度美好时光，增进彼此感情。",
        },
      ];
    },
  },
};
</script>
  